const path = require("path");
const webpack = require("webpack");
const environment = require("./build/environment.js");

module.exports = {
    pages: {
        index: {
            entry:
                process.env.VUE_APP_TYPE == "customer"
                    ? "src/moduleC/main.ts"
                    : "src/moduleS/main.ts",
            title: ""
        }
    },
    publicPath: "./",
    outputDir: `dist/package_${process.env.VUE_APP_TYPE}_${environment.stage}`,
    productionSourceMap: false,
    lintOnSave: false,
    configureWebpack: {
        resolve: {
            alias: {
                img: path.resolve(__dirname, "../public/img")
            }
        },
        plugins: [
            new webpack.DefinePlugin({
                "process.env.STAGE": JSON.stringify(environment.stage)
            })
        ],
    }
    // devServer: {
    //     open: false,
    //     https: false,
    //     hotOnly: false,
    //     proxy: {
    //         '/sunbanke/api/': {
    //             target: 'http://47.102.206.237:80',
    //             ws: true,
    //             changeOrigin: true,
    //             pathRewrite:{
    //                 '^/sunbanke/api/': '/sunbanke/api/'
    //             }
    //         },
    //     }
    // }
    // pwa: {
    //     name: "",
    //     manifestOptions: {
    //         /**
    //          * manifestOptions 默认值
    //          * name: pwa.name
    //            short_name: pwa.name
    //            start_url: '.'
    //            display: 'standalone'
    //            theme_color: pwa.themeColor
    //            icons: [
    //                     { 'src': './img/icons/android-chrome-192x192.png', 'sizes': '192x192', 'type': 'image/png' },
    //                     { 'src': './img/icons/android-chrome-512x512.png', 'sizes': '512x512', 'type': 'image/png' },
    //                     { 'src': './img/icons/android-chrome-maskable-192x192.png', 'sizes': '192x192', 'type': 'image/png', 'purpose': 'maskable' },
    //                     { 'src': './img/icons/android-chrome-maskable-512x512.png', 'sizes': '512x512', 'type': 'image/png', 'purpose': 'maskable' } ]
    //          */
    //         icons: []
    //     },
    //     iconPaths: {
    //         favicon32: 'favicon.ico',
    //         favicon16: 'favicon.ico',
    //         appleTouchIcon: 'favicon.ico',
    //         maskIcon: 'favicon.ico',
    //         msTileImage: 'favicon.ico'
    //     }
    // }
};
